<!doctype html>
<html><head><meta charset="utf-8">
<title>lib/ccv_dpm.c</title>
<link rel="stylesheet" href="/stylesheets/styles.css">
<link rel="stylesheet" href="/stylesheets/coderay.css">
<script src="/javascripts/scale.fix.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-303081-6']);
_gaq.push(['_trackPageview']);
(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head><body><div class="wrapper">
<header><h1><a href="/">ccv</a></h1>
<p>A Modern Computer Vision Library</p>
<p class="view"><a href="https://github.com/liuliu/ccv">View the Project on GitHub <small>liuliu/ccv</small></a></p>
<ul>
<li><a href="https://github.com/liuliu/ccv/zipball/stable">Download <strong>ZIP File</strong></a></li>
<li><a href="https://github.com/liuliu/ccv/tarball/stable">Download <strong>TAR Ball</strong></a></li>
<li><a href="https://github.com/liuliu/ccv">Fork On <strong>GitHub</strong></a></li>
</ul>
</header>
<section><h1>lib/ccv_dpm.c</h1>
<h2 id="ccvdpmmixturemodelnew">ccv_dpm_mixture_model_new</h2>

<pre><code>void ccv_dpm_mixture_model_new(char **posfiles, ccv_rect_t *bboxes, int posnum, char **bgfiles, int bgnum, int negnum, const char *dir, ccv_dpm_new_param_t params)
</code></pre>

<p>Create a new DPM mixture model from given positive examples and background images. This function has hard dependencies on <a href="http://www.gnu.org/software/gsl/">GSL</a> and <a href="http://www.csie.ntu.edu.tw/~cjlin/liblinear/">LibLinear</a>.</p>

<ul>
  <li><strong>posfiles</strong>: An array of positive images.</li>
  <li><strong>bboxes</strong>: An array of bounding boxes for positive images.</li>
  <li><strong>posnum</strong>: Number of positive examples.</li>
  <li><strong>bgfiles</strong>: An array of background images.</li>
  <li><strong>bgnum</strong>: Number of background images.</li>
  <li><strong>negnum</strong>: Number of negative examples that is harvested from background images.</li>
  <li><strong>dir</strong>: The working directory to store/retrieve intermediate data.</li>
  <li><strong>params</strong>: A <strong>ccv_dpm_new_param_t</strong> structure that defines various aspects of the training function.</li>
</ul>

<h2 id="ccvdpmnewparamt">ccv_dpm_new_param_t</h2>

<ul>
  <li><strong>C</strong>: C in SVM.</li>
  <li><strong>alpha</strong>: The step size for stochastic gradient descent.</li>
  <li><strong>alpha_ratio</strong>: Decrease the step size for each iteration. 0.85 is a reasonable number.</li>
  <li><strong>balance</strong>: To balance the weight of positive examples and negative examples. 1.5 is a reasonable number.</li>
  <li><strong>components</strong>: The number of root filters in the mixture model.</li>
  <li><strong>data_minings</strong>: How many data mining procedures are needed for discovering hard examples.</li>
  <li><strong>detector</strong>: A <strong>ccv_dpm_params_t</strong> structure that will be used to search positive examples and negative examples from background images.</li>
  <li><strong>grayscale</strong>: Whether to exploit color in a given image.</li>
  <li><strong>include_overlap</strong>: The percentage of overlap between expected bounding box and the bounding box from detection. Beyond this threshold, it is ensured to be the same object. 0.7 is a reasonable number.</li>
  <li><strong>iterations</strong>: How many iterations needed for stochastic gradient descent.</li>
  <li><strong>max_area</strong>: The maximum area that one part classifier can occupy. 5000 is a reasonable number.</li>
  <li><strong>min_area</strong>: The minimum area that one part classifier can occupy, 3000 is a reasonable number.</li>
  <li><strong>negative_cache_size</strong>: The cache size for negative examples. 1000 is a reasonable number.</li>
  <li><strong>parts</strong>: The number of part filters for each root filter.</li>
  <li><strong>percentile_breakdown</strong>: The percentile use for breakdown threshold. 0.05 is the default.</li>
  <li><strong>relabels</strong>: How many relabel procedures are needed.</li>
  <li><strong>root_relabels</strong>: How many relabel procedures for root classifier are needed.</li>
  <li><strong>symmetric</strong>: Whether to exploit symmetric property of the object.</li>
</ul>

<h2 id="ccvdpmdetectobjects">ccv_dpm_detect_objects</h2>

<pre><code>ccv_dpm_detect_objects(ccv_dense_matrix_t *a, ccv_dpm_mixture_model_t **model, int count, ccv_dpm_param_t params)
</code></pre>

<p>Using a DPM mixture model to detect objects in a given image. If you have several DPM mixture models, it is better to use them in one method call. In this way, ccv will try to optimize the overall performance.</p>

<ul>
  <li><strong>a</strong>: The input image.</li>
  <li><strong>model</strong>: An array of mixture models.</li>
  <li><strong>count</strong>: How many mixture models you’ve passed in.</li>
  <li><strong>params</strong>: A <strong>ccv_dpm_param_t</strong> structure that defines various aspects of the detector.</li>
</ul>

<p><strong>return</strong>: A <strong>ccv_array_t</strong> of <strong>ccv_root_comp_t</strong> that contains the root bounding box as well as its parts.</p>

<h2 id="ccvdpmparamt">ccv_dpm_param_t</h2>

<ul>
  <li><strong>flags</strong>: CCV_DPM_NO_NESTED, if one class of object is inside another class of object, this flag will reject the first object.</li>
  <li><strong>interval</strong>: Interval images between the full size image and the half size one. e.g. 2 will generate 2 images in between full size image and half size one: image with full size, image with 5/6 size, image with 2/3 size, image with 1/2 size.</li>
  <li><strong>min_neighbors</strong>: 0: no grouping afterwards. 1: group objects that intersects each other. &gt; 1: group objects that intersects each other, and only passes these that have at least <strong>min_neighbors</strong> intersected objects.</li>
  <li><strong>threshold</strong>: The threshold the determines the acceptance of an object.</li>
</ul>

<h2 id="ccvdpmreadmixturemodel">ccv_dpm_read_mixture_model</h2>

<pre><code>ccv_dpm_read_mixture_model(const char *directory)
</code></pre>

<p>Read DPM mixture model from a model file.</p>

<ul>
  <li><strong>directory</strong>: The model file for DPM mixture model.</li>
</ul>

<p><strong>return</strong>: A DPM mixture model, 0 if no valid DPM mixture model available.</p>

<h2 id="ccvdpmmixturemodelfree">ccv_dpm_mixture_model_free</h2>

<pre><code>void ccv_dpm_mixture_model_free(ccv_dpm_mixture_model_t *model)
</code></pre>

<p>Free up the memory of DPM mixture model.</p>

<ul>
  <li><strong>model</strong>: The DPM mixture model.</li>
</ul>

<h3><a href="/">&lsaquo;&nbsp;&nbsp;back&nbsp;</a></h3>
<div id="disqus_thread"></div>
<script type="text/javascript">
	var disqus_shortname = 'libccv';
	(function() {
		var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
		dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
		(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
	})();
</script>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>

</section>
<footer>
<p>This project is maintained by <a href="https://liuliu.me/">liuliu</a></p>
<p><small>Theme originated from <a href="https://github.com/orderedlist">orderedlist</a></small></p>
</footer>
</div>
<!--[if !IE]><script>fixScale(document);</script><!--<![endif]-->
</body>
</html>
